<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="utf-8">
    <title>理财产品订单</title>
    <meta name="keywords" content=""/>
    <meta name="description" content=""/>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <link rel="stylesheet" href="../../layui/css/layui.css">
    <link rel="stylesheet" href="../../xznstatic/css/common.css"/>
    <link rel="stylesheet" href="../../xznstatic/css/style.css"/>
    <script type="text/javascript" src="../../xznstatic/js/jquery-1.11.3.min.js"></script>
    <script type="text/javascript" src="../../xznstatic/js/jquery.SuperSlide.2.1.1.js"></script>
    <link rel="stylesheet" href="../../xznstatic/css/bootstrap.min.css" />

    <link rel="stylesheet" href="../../css/theme.css"/>
</head>
<style>
    .center-container {
        width: 1200px;
        margin: 0 auto;
        margin-top: 20px;
        display: flex;
        margin-bottom: 20px;
    }
.prolist .left_nav {
        background: #fff;
        width: 220px;
    }
    .prolist .left_nav .dlx1 {
        padding: 15px 0;
        padding-left: 20px;
        background: var(--publicMainColor);
        color: #fff;
    }
    .prolist .left_nav .dlx1 dt {
        font-size: 22px;
        font-weight: bold;
    }
    .prolist .left_nav .dlx1 dd {
        padding-top: 5px;
        font-size: 14px;
        font-weight: 200;
    }
    .prolist .left_nav .dlx2 {
        padding: 15px 0;
        padding-left: 20px;
        background: var(--publicMainColor);
        color: #fff;
    }
    .prolist .left_nav .dlx2 dt {
        font-size: 14px;
    }
    .prolist .left_nav .dlx2 dd {
        padding-top: 5px;
        font-size: 22px;
        color:  var(--publicSubColor);
        font-family: impact;
    }
    .prolist .left_nav ul {
        padding: 20px;
    }
    .prolist .left_nav ul li {
        display: block;
        margin-bottom: 15px;
    }
    .prolist .left_nav ul li:last-child {
        margin-bottom: 0;
    }
    .prolist .left_nav ul li {
        background-color: var(--publicSubColor);
        display: block;
        border: 1px solid #ddd;
        padding: 15px 10px;
        color: #666;
        font-size: 12px;
    }
    .prolist .left_nav ul li i {
        color:  var(--publicMainColor);
        margin-right: 10px;
    }
    .prolist .left_nav ul li:hover {
        border: 1px solid var(--publicMainColor);
        background: var(--publicMainColor);
        color: #fff;
    }
    .prolist .left_nav ul li:hover i {
        color: var(--publicSubColor);
    }
    .onclickbiaoqian{
        color: #fff !important;
        background-color: var(--publicMainColor) !important;
    }
    .onclickbiaoqian i{
        color:  var(--publicSubColor) !important;
    }</style>
<body class='bodyClass'>
<div id="app">
    <el-dialog title="弹出内容" :visible.sync="showContentModal" :modal-append-to-body="false">
        <div class="content" style="word-break: break-all;" v-html="showContent">
        </div>
        <div slot="footer" class="dialog-footer">
            <el-button @click="showContentModal = false">关 闭</el-button>
        </div>
    </el-dialog>
    <el-dialog title="审核" :visible.sync="licaichanpinOrderYesnoTypesVisible">
        <el-form :model="form">
            <input type="hidden" v-model="form.id">
            <el-form-item label="审核" >
                <el-select v-model="form.licaichanpinOrderYesnoTypes" placeholder="请选择审核状态">
                    <el-option label="同意" value="2"></el-option>
                    <el-option label="拒绝" value="3"></el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="审核意见">
                <el-input type="textarea" v-model="form.licaichanpinOrderYesnoText" placeholder="审核意见"></el-input>
            </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button @click="licaichanpinOrderYesnoTypesVisible = false">取 消</el-button>
            <el-button type="primary" @click="licaichanpinOrderYesnoTypesShenhe">审 核</el-button>
        </div>
    </el-dialog>
<!-- 标题 -->

    <el-dialog title="评论" :visible.sync="licaichanpinCommentbackModal" :modal-append-to-body="false">
        <el-form>
            <el-form-item label="评论信息">
                <el-input type="textarea" v-model="licaichanpinCommentbackContent"></el-input>
            </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button @click="licaichanpinCommentbackModal = false">取 消</el-button>
            <el-button type="primary" @click="submitLicaichanpinCommentback()">确 定</el-button>
        </div>
    </el-dialog>

    <!-- 标题 -->
    <div class="center-container">
        <!-- 个人中心菜单 config.js-->
<div class="prolist">
    <div class="left_nav">
        <dl class="dlx1">
            <dt>理财产品订单</dt>
            <dd>USER / CENTER</dd>
        </dl>
        <ul>
            <li  v-for="(item,index) in centerMenu" v-bind:key="index" @click="jump(item.url)"
                 :class="item.url=='../licaichanpinOrder/list.html'?'onclickbiaoqian':''"><i class="layui-icon">&#xe6b1;</i>{{item.name}}</li>
        </ul>
    </div>
</div>        <!-- 个人中心菜单 -->
        <div class="right-container sub_borderColor" :style='{"padding":"20px","boxShadow":"0px rgba(255,0,0,.8)","margin":"0","backgroundColor":"#fff","borderRadius":"0","borderWidth":"1px","borderStyle":"solid","width":"80%"}'>
            <div style="display: flex;height: 60px;align-items: center;margin-left: 15px;">
                <div style="display: flex;height: 60px;align-items: center;margin-left: 15px;">
                    <div class="thisTableType-search" style="margin-left: 15px;"
                         :style='searchForm.licaichanpinOrderTypes=="" || searchForm.licaichanpinOrderTypes==null?{"color":"red","borderBottom":"1px solid red"}:{"color":"#000"}'>
                        全部
                    </div>
                    <div style="margin-left: 15px;" v-for="item in licaichanpinOrderTypesList" :index="item.codeIndex" class="thisTableType-search"
                         :style='searchForm.licaichanpinOrderTypes==item.codeIndex?{"color":"red","borderBottom":"1px solid red"}:{"color":"#000"}'>
                        {{item.indexName}}
                    </div>
                </div>
            </div>
            <div style="width: 90%;height: 40px;margin: 0 auto;display: flex;background-color: #f3f3f3;line-height: 40px;;text-align: center">
                <div style="width: 33%">
                    订单详情
                </div>
                <div style="width: 25%">
                </div>
                <div style="width: 19%">
                    金额
                </div>
                <div style="width: 6%">
                    状态
                </div>
                <div style="width: 16%">
                    操作
                </div>
            </div>
            <div style="width: 90%;margin: 0 auto;border: 1px solid #f3f3f3;margin-top: 15px;"
                 v-for="(item,index) in dataList" v-bind:key="index">
                <div
                        style="height: 40px;background-color: #f3f3f3;display: flex;    align-items: center;">
                    <div style="margin-left: 15px;">
                        {{item.insertTime}}
                    </div>
                    <div style="margin-left: 50px;">
                        订单编号:{{item.licaichanpinOrderUuidNumber}}
                    </div>
                    <div style="margin-left: 50px;" v-if="item.licaichanpinOrderTypes != 101 && item.licaichanpinOrderTypes != 102 && item.licaichanpinOrderCourierName != null">
                        {{item.licaichanpinOrderCourierName}}：{{item.licaichanpinOrderCourierNumber}}
                    </div>
                    <!-- <div style="margin-right: 15px;">
                        用户姓名:{{item.yonghuName}}
                    </div> -->
                </div>
                <div style="display: flex;">
                    <div style="width: 60%;display: flex;">
                        <div style="display: flex;">
                            <img :src="baseUrl+item.licaichanpinPhoto"
                                 style="width: 100px;height: 100px;object-fit: cover;margin: 15px;">
                            <div style="margin: 15px;">
                                <div style="font-size: 14px;">
                                    {{item.licaichanpinName}}
                                </div>
                                <div style="font-size: 12px;color: #666;">
                                    {{item.licaichanpinValue}}
                                </div>
                            </div>
                        </div>
                                <div style="margin: 15px;" v-if="item.buyZuoweiTime || item.buyNumber">
                                    x{{item.buyNumber}}
                                </div>
                    </div>
                    <div style="width: 10%;margin: 15px;">
                    </div>
                    <div style="width: 10%;margin: 15px;">
                        {{item.licaichanpinOrderTruePrice}}
                        <div>{{item.licaichanpinOrderPaymentValue}}</div>
                    </div>
                    <div style="width: 10%;margin: 15px;">
                        {{item.licaichanpinOrderValue}}
                    </div>
                    <div style="width: 10%;margin: 15px;">
                        <button v-if="item.licaichanpinOrderTypes==101" @click="refund(item.id)" type="button" class="layui-btn layui-btn-sm layui-btn-radius layui-btn-warm">
                            <i class="layui-icon">&#xe65e;</i> 取消购买
                        </button>
                        <button v-if="item.licaichanpinOrderTypes==103" @click="commentback(item.id)" type="button" class="layui-btn layui-btn-sm layui-btn-radius btn-theme">
                            <i class="layui-icon">&#xe65e;</i> 评价
                        </button>
                        <button v-if="item.licaichanpinOrderTypes==1 && false" @click="wuyong(item.id)" type="button" class="layui-btn layui-btn-sm layui-btn-radius layui-btn-warm">
                            无用按钮
                        </button>
                    </div>
                </div>
            </div>
            <div class="pager" style="margin-bottom: 50px;" id="pager" :style="{textAlign:'center'}"></div>
        </div>
    </div></div>

<script src="../../xznstatic/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../xznstatic/js/echarts.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../layui/layui.js"></script>
<script src="../../js/vue.js"></script>
<!-- 引入element组件库 -->
<script src="../../xznstatic/js/element.min.js"></script>
<!-- 引入element样式 -->
<link rel="stylesheet" href="../../xznstatic/css/element.min.css">
<script src="../../js/config.js"></script>
<script src="../../modules/config.js"></script>
<script src="../../js/utils.js"></script>

<script type="text/javascript">
    Vue.prototype.myFilters = function (msg) {
        if(msg==null || msg==""){
            return "";
        }else if (msg.length>20){
            msg.replace(/\n/g, "<br>");
            return msg.substring(0,30)+"......";
        }else{
            return msg.replace(/\n/g, "<br>");
        }
    };
    var vue = new Vue({
        el: '#app',
        data: {
            userId: localStorage.getItem("userid"),//当前登录人的id
            sessionTable: localStorage.getItem("userTable"),//登录账户所在表名
            role: localStorage.getItem("role"),//权限
            user:{},//当前登录用户信息
            form:{
                licaichanpinOrderUuidNumber: new Date().getTime(),//数字
                licaichanpinId: '',
                yonghuId: '',
                yinhangkaId: '',
                buyNumber: '',
                licaichanpinOrderTruePrice: '',
                licaichanpinOrderTypes: '',//数字
                licaichanpinOrderValue: '',//数字对应的值
                licaichanpinOrderYesnoTypes: '',//数字
                licaichanpinOrderYesnoValue: '',//数字对应的值
                licaichanpinOrderYesnoText: null,
                licaichanpinOrderShenheTime: '',
                licaichanpinOrderPaymentTypes: '',//数字
                licaichanpinOrderPaymentValue: '',//数字对应的值
                insertTime: '',
                createTime: '',
            },
            licaichanpinOrderYesnoTypesVisible : false,
            //小菜单
            centerMenu: centerMenu,
            //项目路径
            baseUrl:"",
            //弹出内容模态框
            showContentModal:false,
            showContent:"",
            licaichanpinOrderTypesList: [],
            licaichanpinOrderYesnoTypesList: [],
            licaichanpinOrderPaymentTypesList: [],

            //订单评论模态框
            licaichanpinCommentbackContent: null,//评价内容
            licaichanpinCommentbackId: null,//操作数据id
            licaichanpinCommentbackModal: false,//模态框状态
            licaichanpinCommentbackPingfenNumber:0,//评分
            //查询条件
            searchForm: {
                page: 1
                ,limit: 8
                ,sort: "id"//字段
                ,order: "desc"//asc desc
     
                ,yonghuId: localStorage.getItem('userid')//只能查询自己
                    ,licaichanpinOrderUuidNumber: ""
                ,licaichanpinOrderTypes: ""
                ,licaichanpinOrderYesnoText: ""
                ,licaichanpinOrderPaymentTypes: ""
            },

            dataList: [],
        },
        filters: {
            subString: function(val) {
                if (val) {
                    val = val.replace(/<[^<>]+>/g, '').replace(/undefined/g, '');
                    if (val.length > 60) {
                        val = val.substring(0, 60);
                        val+='...';
                    }
                    return val;
                }
                return '';
            }
        },
        computed: {
        },
        methods: {
            isAuth(tablename, button) {
                return isFrontAuth(tablename, button);
            },
            jump(url) {
                jump(url);
            },
            jumpCheck(url,check1,check2) {
                if(check1 == "2" || check1 == 2){//级联表的逻辑删除字段[1:未删除 2:已删除]
                    layui.layer.msg("已经被删除", {
                        time: 2000,
                        icon: 2
                    });
                    return false;
                }
                if(check2 == "2"  || check2 == 2){//是否下架[1:上架 2:下架]
                    layui.layer.msg("已经下架", {
                        time: 2000,
                        icon: 2
                    });
                    return false;
                }
                this.jump(url);
            },
            showContentFunction(content) {
                this.showContentModal=true;
                this.showContent=content.replaceAll(/\n/g, "<br>").replaceAll("src=\"upload/","src=\""+this.baseUrl+"upload/");
            },
            wuyong(id) {
                var mymessage = confirm("确定要    吗？");if(!mymessage){return false;}
                layui.http.requestJson(`licaichanpinOrder/update`, 'post', {
                    id:id,
//                    licaichanpinOrderTypes:1,
                }, function (res) {
                    if(res.code == 0){
                        layui.layer.msg('操作成功', {time: 2000, icon: 6 }, function () {window.location.reload();});
                    }else{
                        layui.layer.msg(res.msg, {time: 5000,icon: 5});
                    }
                });
            },
            deleteData(data){
                var mymessage = confirm("确定要删除这条数据吗？");
                if(!mymessage){
                    return false;
                }
                // 删除信息
                layui.http.requestJson(`licaichanpinOrder/delete`, 'post', [data.id], (res) => {
                    if(res.code==0){
                        layer.msg('操作成功', {
                            time: 2000,
                            icon: 6
                        });
                        window.location.reload();
                    }else{
                        layer.msg(res.msg, {
                            time: 2000,
                            icon: 2
                        });
                    }
                });
            },
            // 取消购买
            refund(id) {
                var mymessage = confirm("确定要取消购买吗？");
                if(!mymessage){return false;}
                layui.http.request(`licaichanpinOrder/refund?id=`+id, 'get', {}, (res) => {
                    if(res.code==0){
                        layer.msg('操作成功', {time: 2000,icon: 6});
                        window.location.reload();
                    }else{
                        layer.msg(res.msg, {time: 2000,icon: 2});
                    }
                });
            },

            // 打开评价模态框
            commentback(id) {
                this.licaichanpinCommentbackContent = null//置空评价内容
                this.licaichanpinCommentbackId = id//设置订单id
                this.licaichanpinCommentbackModal = true//打开模态框
            },
            // 提交评价
            submitLicaichanpinCommentback(){
                 if(this.licaichanpinCommentbackContent == null || this.licaichanpinCommentbackContent == "" || this.licaichanpinCommentbackContent == "null"){
                    layer.msg("评价内容不能为空", {time: 2000,icon: 2});
                    return false;
                }
                let _this = this
                layui.http.request("licaichanpinOrder/commentback?id="+this.licaichanpinCommentbackId+"&commentbackText="+this.licaichanpinCommentbackContent + "&licaichanpinCommentbackPingfenNumber="+this.licaichanpinCommentbackPingfenNumber, 'get', {}, function (res) {
                    if(res.code==0){
                        layer.msg('操作成功', {time: 2000,icon: 6});
                        window.location.reload();
                    }else{
                        layer.msg(res.msg, {time: 2000,icon: 2});
                    }
                    _this.licaichanpinCommentbackModal = false
                });
            },

            /*审核模态框*/
            openYesnoTypes(id) {
                let _this = this;
                _this.form.id = null;
                _this.form.id = id;
                _this.form.licaichanpinOrderYesnoText = null;
                _this.form.licaichanpinOrderYesnoTypes = "请选择审核状态";
                _this.licaichanpinOrderYesnoTypesVisible = true;
            },

            licaichanpinOrderYesnoTypesShenhe() {
                let _this = this;
                if(_this.form.licaichanpinOrderYesnoTypes == "请选择审核状态"){
                    layui.layer.msg("请选择审核状态", {time: 2000,icon: 2});return false;
                }
                if(_this.form.licaichanpinOrderYesnoText == null || _this.form.licaichanpinOrderYesnoText == ""){
                    layui.layer.msg("请输入审核意见", {time: 2000,icon: 2});return false;
                }
                layui.http.requestJson('licaichanpinOrder/shenhe', 'post', _this.form, function (res) {
                    if (res && res.code === 0) {
                        layui.layer.msg("审核成功", {time: 5000,icon: 6});
                        window.location.reload();
                    } else {
                        layui.layer.msg(res.msg, {time: 2000,icon: 2});
                        _this.licaichanpinOrderYesnoTypesVisible = false;
                    }
                });
            },
        }
    });

    layui.use(['layer', 'element', 'carousel', 'laypage', 'http', 'jquery', 'laydate', 'tinymce'], function() {
        var layer = layui.layer;
        var element = layui.element;
        var carousel = layui.carousel;
        var laypage = layui.laypage;
        var http = layui.http;
        var laydate = layui.laydate;
        var tinymce = layui.tinymce;
        window.jQuery = window.$ = jquery = layui.jquery;

        localStorage.setItem("goUtl","./pages/licaichanpinOrder/list.html")

        vue.baseUrl = http.baseurl

        let table = localStorage.getItem("userTable");
        if(table){
            http.request(table+"/session", 'get', {}, function (data) {
                vue.user = data.data;
            });
        }



        //订单类型的动态搜素
        $(document).on("click", ".thisTableType-search", function (e) {
            vue.searchForm.licaichanpinOrderTypes = $(this).attr('index');
            pageList();
        });


            //当前表的 订单类型 字段 字典表查询
            licaichanpinOrderTypesSelect();
            //当前表的 审核状态 字段 字典表查询
            licaichanpinOrderYesnoTypesSelect();
                                                                           //当前表的 订单类型 字段 字典表查询方法
           function licaichanpinOrderTypesSelect() {
               http.request("dictionary/page?page=1&limit=100&sort=&order=&dicCode=licaichanpin_order_types", 'get', {}, function (res) {
                   if(res.code == 0){
                       vue.licaichanpinOrderTypesList = res.data.list;
                   }
               });
           }
                   //当前表的 审核状态 字段 字典表查询方法
           function licaichanpinOrderYesnoTypesSelect() {
               http.request("dictionary/page?page=1&limit=100&sort=&order=&dicCode=licaichanpin_order_yesno_types", 'get', {}, function (res) {
                   if(res.code == 0){
                       vue.licaichanpinOrderYesnoTypesList = res.data.list;
                   }
               });
           }
                                        

            // 分页列表
            pageList();

            // 搜索按钮
            jquery('#btn-search').click(function (e) {
                pageList();
            });

            function pageList() {
                // 获取列表数据
                http.request('licaichanpinOrder/list', 'get', vue.searchForm, function (res) {
                    vue.dataList = res.data.list;
                    // 分页
                    laypage.render({
                        elem: 'pager',
                        count: res.data.total,
                        limit: vue.searchForm.limit,
                        groups: 3,
                        layout: ["prev", "page", "next"],
                        jump: function (obj, first) {
                            vue.searchForm.page = obj.curr;//翻页
                            //首次不执行
                            if (!first) {
                                http.request('licaichanpinOrder/list', 'get', vue.searchForm, function (res1) {
                                    vue.dataList = res1.data.list;
                                })
                            }
                        }
                    });
                });
            }
    });

    window.xznSlide = function () {
        jQuery(".banner").slide({mainCell: ".bd ul", autoPlay: true, interTime: 5000});
        jQuery("#ifocus").slide({
            titCell: "#ifocus_btn li",
            mainCell: "#ifocus_piclist ul",
            effect: "leftLoop",
            delayTime: 200,
            autoPlay: true,
            triggerTime: 0
        });
        jQuery("#ifocus").slide({titCell: "#ifocus_btn li", mainCell: "#ifocus_tx ul", delayTime: 0, autoPlay: true});
        jQuery(".product_list").slide({
            mainCell: ".bd ul",
            autoPage: true,
            effect: "leftLoop",
            autoPlay: true,
            vis: 5,
            trigger: "click",
            interTime: 4000
        });
    };
</script>
</body>
</html>
